3.9.15 \(\int (d \csc (e+f x))^n (a+a \sin (e+f x))^2 \, dx\) [815]

Optimal. Leaf size=203 \[ \frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{-2+n}}{f (1-n)}+\frac {2 a^2 d^2 \cos (e+f x) (d \csc (e+f x))^{-2+n} \, _2F_1\left (\frac {1}{2},\frac {2-n}{2};\frac {4-n}{2};\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 d^3 (3-2 n) \cos (e+f x) (d \csc (e+f x))^{-3+n} \, _2F_1\left (\frac {1}{2},\frac {3-n}{2};\frac {5-n}{2};\sin ^2(e+f x)\right )}{f (1-n) (3-n) \sqrt {\cos ^2(e+f x)}} \]

[Out]

a^2*d^2*cot(f*x+e)*(d*csc(f*x+e))^(-2+n)/f/(1-n)+2*a^2*d^2*cos(f*x+e)*(d*csc(f*x+e))^(-2+n)*hypergeom([1/2, 1-
1/2*n],[2-1/2*n],sin(f*x+e)^2)/f/(2-n)/(cos(f*x+e)^2)^(1/2)+a^2*d^3*(3-2*n)*cos(f*x+e)*(d*csc(f*x+e))^(-3+n)*h
ypergeom([1/2, 3/2-1/2*n],[5/2-1/2*n],sin(f*x+e)^2)/f/(n^2-4*n+3)/(cos(f*x+e)^2)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.17, antiderivative size = 203, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3317, 3873, 3857, 2722, 4131} \begin {gather*} \frac {a^2 d^3 (3-2 n) \cos (e+f x) (d \csc (e+f x))^{n-3} \, _2F_1\left (\frac {1}{2},\frac {3-n}{2};\frac {5-n}{2};\sin ^2(e+f x)\right )}{f (1-n) (3-n) \sqrt {\cos ^2(e+f x)}}+\frac {2 a^2 d^2 \cos (e+f x) (d \csc (e+f x))^{n-2} \, _2F_1\left (\frac {1}{2},\frac {2-n}{2};\frac {4-n}{2};\sin ^2(e+f x)\right )}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{n-2}}{f (1-n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(d*Csc[e + f*x])^n*(a + a*Sin[e + f*x])^2,x]

[Out]

(a^2*d^2*Cot[e + f*x]*(d*Csc[e + f*x])^(-2 + n))/(f*(1 - n)) + (2*a^2*d^2*Cos[e + f*x]*(d*Csc[e + f*x])^(-2 +
n)*Hypergeometric2F1[1/2, (2 - n)/2, (4 - n)/2, Sin[e + f*x]^2])/(f*(2 - n)*Sqrt[Cos[e + f*x]^2]) + (a^2*d^3*(
3 - 2*n)*Cos[e + f*x]*(d*Csc[e + f*x])^(-3 + n)*Hypergeometric2F1[1/2, (3 - n)/2, (5 - n)/2, Sin[e + f*x]^2])/
(f*(1 - n)*(3 - n)*Sqrt[Cos[e + f*x]^2])

Rule 2722

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*((b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1
)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n
}, x] &&  !IntegerQ[2*n]

Rule 3317

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^(n_.))^(p_.), x_Symbol] :> Dist
[d^(n*p), Int[(d*Csc[e + f*x])^(m - n*p)*(b + a*Csc[e + f*x]^n)^p, x], x] /; FreeQ[{a, b, d, e, f, m, n, p}, x
] &&  !IntegerQ[m] && IntegersQ[n, p]

Rule 3857

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x])^(n - 1)*((Sin[c + d*x]/b)^(n - 1)
*Int[1/(Sin[c + d*x]/b)^n, x]), x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rule 3873

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Dist[2*a*(b/d
), Int[(d*Csc[e + f*x])^(n + 1), x], x] + Int[(d*Csc[e + f*x])^n*(a^2 + b^2*Csc[e + f*x]^2), x] /; FreeQ[{a, b
, d, e, f, n}, x]

Rule 4131

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[(-C)*Cot
[e + f*x]*((b*Csc[e + f*x])^m/(f*(m + 1))), x] + Dist[(C*m + A*(m + 1))/(m + 1), Int[(b*Csc[e + f*x])^m, x], x
] /; FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] &&  !LeQ[m, -1]

Rubi steps

\begin {align*} \int (d \csc (e+f x))^n (a+a \sin (e+f x))^2 \, dx &=d^2 \int (d \csc (e+f x))^{-2+n} (a+a \csc (e+f x))^2 \, dx\\ &=\left (2 a^2 d\right ) \int (d \csc (e+f x))^{-1+n} \, dx+d^2 \int (d \csc (e+f x))^{-2+n} \left (a^2+a^2 \csc ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{-2+n}}{f (1-n)}+\frac {\left (a^2 d^2 (3-2 n)\right ) \int (d \csc (e+f x))^{-2+n} \, dx}{1-n}+\left (2 a^2 d (d \csc (e+f x))^n \left (\frac {\sin (e+f x)}{d}\right )^n\right ) \int \left (\frac {\sin (e+f x)}{d}\right )^{1-n} \, dx\\ &=\frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{-2+n}}{f (1-n)}+\frac {2 a^2 \cos (e+f x) (d \csc (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {2-n}{2};\frac {4-n}{2};\sin ^2(e+f x)\right ) \sin ^2(e+f x)}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {\left (a^2 d^2 (3-2 n) (d \csc (e+f x))^n \left (\frac {\sin (e+f x)}{d}\right )^n\right ) \int \left (\frac {\sin (e+f x)}{d}\right )^{2-n} \, dx}{1-n}\\ &=\frac {a^2 d^2 \cot (e+f x) (d \csc (e+f x))^{-2+n}}{f (1-n)}+\frac {2 a^2 \cos (e+f x) (d \csc (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {2-n}{2};\frac {4-n}{2};\sin ^2(e+f x)\right ) \sin ^2(e+f x)}{f (2-n) \sqrt {\cos ^2(e+f x)}}+\frac {a^2 (3-2 n) \cos (e+f x) (d \csc (e+f x))^n \, _2F_1\left (\frac {1}{2},\frac {3-n}{2};\frac {5-n}{2};\sin ^2(e+f x)\right ) \sin ^3(e+f x)}{f (1-n) (3-n) \sqrt {\cos ^2(e+f x)}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 1.29, size = 346, normalized size = 1.70 \begin {gather*} -\frac {2 (d \csc (e+f x))^n \sec ^2\left (\frac {1}{2} (e+f x)\right )^{-n} (a+a \sin (e+f x))^2 \tan \left (\frac {1}{2} (e+f x)\right ) \left ((-2+n) \, _2F_1\left (1-n,\frac {1}{2}-\frac {n}{2};\frac {3}{2}-\frac {n}{2};-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right )+4 (-2+n) \, _2F_1\left (2-n,\frac {1}{2}-\frac {n}{2};\frac {3}{2}-\frac {n}{2};-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right )+8 \, _2F_1\left (3-n,\frac {1}{2}-\frac {n}{2};\frac {3}{2}-\frac {n}{2};-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right )-4 n \, _2F_1\left (3-n,\frac {1}{2}-\frac {n}{2};\frac {3}{2}-\frac {n}{2};-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right )-4 \, _2F_1\left (2-n,1-\frac {n}{2};2-\frac {n}{2};-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right ) \tan \left (\frac {1}{2} (e+f x)\right )+4 n \, _2F_1\left (2-n,1-\frac {n}{2};2-\frac {n}{2};-\tan ^2\left (\frac {1}{2} (e+f x)\right )\right ) \tan \left (\frac {1}{2} (e+f x)\right )\right )}{f (-2+n) (-1+n) \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^4} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(d*Csc[e + f*x])^n*(a + a*Sin[e + f*x])^2,x]

[Out]

(-2*(d*Csc[e + f*x])^n*(a + a*Sin[e + f*x])^2*Tan[(e + f*x)/2]*((-2 + n)*Hypergeometric2F1[1 - n, 1/2 - n/2, 3
/2 - n/2, -Tan[(e + f*x)/2]^2] + 4*(-2 + n)*Hypergeometric2F1[2 - n, 1/2 - n/2, 3/2 - n/2, -Tan[(e + f*x)/2]^2
] + 8*Hypergeometric2F1[3 - n, 1/2 - n/2, 3/2 - n/2, -Tan[(e + f*x)/2]^2] - 4*n*Hypergeometric2F1[3 - n, 1/2 -
 n/2, 3/2 - n/2, -Tan[(e + f*x)/2]^2] - 4*Hypergeometric2F1[2 - n, 1 - n/2, 2 - n/2, -Tan[(e + f*x)/2]^2]*Tan[
(e + f*x)/2] + 4*n*Hypergeometric2F1[2 - n, 1 - n/2, 2 - n/2, -Tan[(e + f*x)/2]^2]*Tan[(e + f*x)/2]))/(f*(-2 +
 n)*(-1 + n)*(Sec[(e + f*x)/2]^2)^n*(Cos[(e + f*x)/2] + Sin[(e + f*x)/2])^4)

________________________________________________________________________________________

Maple [F]
time = 0.40, size = 0, normalized size = 0.00 \[\int \left (d \csc \left (f x +e \right )\right )^{n} \left (a +a \sin \left (f x +e \right )\right )^{2}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x)

[Out]

int((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x, algorithm="maxima")

[Out]

integrate((a*sin(f*x + e) + a)^2*(d*csc(f*x + e))^n, x)

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x, algorithm="fricas")

[Out]

integral(-(a^2*cos(f*x + e)^2 - 2*a^2*sin(f*x + e) - 2*a^2)*(d*csc(f*x + e))^n, x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int \left (d \csc {\left (e + f x \right )}\right )^{n}\, dx + \int 2 \left (d \csc {\left (e + f x \right )}\right )^{n} \sin {\left (e + f x \right )}\, dx + \int \left (d \csc {\left (e + f x \right )}\right )^{n} \sin ^{2}{\left (e + f x \right )}\, dx\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*csc(f*x+e))**n*(a+a*sin(f*x+e))**2,x)

[Out]

a**2*(Integral((d*csc(e + f*x))**n, x) + Integral(2*(d*csc(e + f*x))**n*sin(e + f*x), x) + Integral((d*csc(e +
 f*x))**n*sin(e + f*x)**2, x))

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*csc(f*x+e))^n*(a+a*sin(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((a*sin(f*x + e) + a)^2*(d*csc(f*x + e))^n, x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int {\left (\frac {d}{\sin \left (e+f\,x\right )}\right )}^n\,{\left (a+a\,\sin \left (e+f\,x\right )\right )}^2 \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d/sin(e + f*x))^n*(a + a*sin(e + f*x))^2,x)

[Out]

int((d/sin(e + f*x))^n*(a + a*sin(e + f*x))^2, x)

________________________________________________________________________________________